var queryStr = "";

/**
 * 页码改变
 * 
 * @param pageNum
 */
function pageChange(pageNum) {
	valueSet(pageNum);
	lableShow();
}
function query() {

}
$(function(){
	lableShow();
});

function typeChange(){
	var type=$("#typeSelect").val();
	$("#typeLable").val(type);
	lableShow();
}

function lableShow() {
	var content = "";
	$
			.post(
					"getLableList",
					$("#lableForm").serialize(),
					function(responseResult) {
						// alert(responseResult.userList.length);
						if (responseResult.labelList.length > 0) {
							$(responseResult.labelList)
									.each(
											function(i) {
												content += "<tr><td><input type='checkbox' id='"+this.id+"'/></td>" +
														"<td>"+(i+1)+"</td><td>"+this.lable+"</td></tr>";
											});
							$('#bodyShow').html(content);
						} else {
							$('#bodyShow').append("无相关数据！");
						}
					});
}

// 实现全选的js代码
function sellectAll() {
	var input = document.getElementsByTagName("input");
	var notSelectCount = 0;
	var inputCount = input.length;
	for (var i = 0; i < inputCount; i++) {
		if (input[i].type == "checkbox") {
			if (input[i].checked == false) {
				notSelectCount++;
			}
		}
	}
	if (notSelectCount == 1) {
		for (var i = 0; i < inputCount; i++) {
			if (input[i].type == "checkbox") {
				input[i].checked = false;
			}
		}
	} else {
		for (var i = 0; i < inputCount; i++) {
			if (input[i].type == "checkbox") {
				input[i].checked = true;
			}
		}
	}
}

/**
 * 获取多选框的id组合
 * 
 * @returns {String}
 */
function valueGetFromCheckbox() {
	var input = document.getElementsByTagName("input");
	var inputCount = input.length;
	var values = "";
	for (var i = 0; i < inputCount; i++) {
		if (input[i].type == "checkbox" && input[i].checked) {
			if (values == "") {
				values += input[i].id;
			} else
				values += "," + input[i].id;
		}
	}
	return values;
}

function lableBtn(){
	var values = valueGetFromCheckbox();
	if(values.trim() == ""){
		alert("请选择标签。");
		return;
	}
	var type=$("#typeSelect").val();
	$("#typeLable").val(type);
	$("#labelIdStrInput").val(values);
	$.post("classifyArchives",$("#valueForm").serialize(),function(responseResult){
		alert(responseResult.responseParam.message);
	});
//	window.location=('manager55.html');
}
